// HomePath.cpp : implementation file
//

#include "stdafx.h"
#include "vc10.h"
#include "HomePath.h"

#ifdef _DEBUG
#define new DEBUG_NEW
#undef THIS_FILE
static char THIS_FILE[] = __FILE__;
#endif

/////////////////////////////////////////////////////////////////////////////
// CHomePath dialog


CHomePath::CHomePath(CWnd* pParent /*=NULL*/)
	: CDialog(CHomePath::IDD, pParent)
{
	//{{AFX_DATA_INIT(CHomePath)
	m_homePath = _T("");
	//}}AFX_DATA_INIT
}


void CHomePath::DoDataExchange(CDataExchange* pDX)
{
	CDialog::DoDataExchange(pDX);
	//{{AFX_DATA_MAP(CHomePath)
	DDX_Text(pDX, IDC_HOME_PATH, m_homePath);
	//}}AFX_DATA_MAP
}


BEGIN_MESSAGE_MAP(CHomePath, CDialog)
	//{{AFX_MSG_MAP(CHomePath)
	ON_BN_CLICKED(IDC_BUTTON1, OnButton1)
	//}}AFX_MSG_MAP
END_MESSAGE_MAP()

/////////////////////////////////////////////////////////////////////////////
// CHomePath message handlers

#include <shlobj.h>
void CHomePath::OnButton1() 
{
	// TODO: Add your control notification handler code here

	          BROWSEINFO bi;
			  CString path, folder;
			  bi.hwndOwner = this->m_hWnd;
			  bi.pidlRoot = NULL;
			  bi.pszDisplayName = folder.GetBuffer(MAX_PATH); 
			  bi.lpszTitle = _T("HOME PATH SETUP:");
			  bi.ulFlags = 0; 
			  bi.lpfn = NULL;
			  bi.lParam = 0;
			  bi.iImage = 0;
			  
			  LPITEMIDLIST pidl = SHBrowseForFolder( &bi);
			  
			  SHGetPathFromIDList(pidl, path.GetBuffer(MAX_PATH));
			  folder.ReleaseBuffer();
			  path.ReleaseBuffer();

	m_homePath = path;
	UpdateData(false);
	
}
